package com.battery;

import com.battery.netty.NettyServer;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication

//@MapperScan("com.battery.dao")
//public class DemoApplication  implements CommandLineRunner{
//
//	@Autowired
//    NettyServer nettyServer;
//
//	public static void main(String[] args) {
//		SpringApplication.run(DemoApplication.class, args);
//	}
//
//	@Override
//	public void run(String... args) throws Exception {
//		// TODO Auto-generated method stub
//		//随着springboot启动而启动netty服务
//		ChannelFuture future = nettyServer.start();
//	    Runtime.getRuntime().addShutdownHook(new Thread(){
//	            @Override
//	            public void run() {
//	            	nettyServer.destroy();
//	            }
//	        });
//	    future.channel().closeFuture().syncUninterruptibly();
//
//	}
//
//}

@MapperScan("com.battery.dao")
public class DemoApplication  {

	@Autowired
	NettyServer nettyServer;

	public static void main(String[] args) {
		SpringApplication.run(com.battery.DemoApplication.class, args);
	}


}

